let mongoose = require('mongoose')

const BindSchema = new mongoose.Schema({
  userId: mongoose.Schema.Types.ObjectId,
  name: String,
  mobile: String,
  bindInfo: [{
    type: Number,
    sourceId: mongoose.Schema.Types.ObjectId,
    cardNo1: String,
    cardNo2: String
  }],
  isBind: Boolean,
  bindTime: Date,
  unbindTime: Date,
  unbindReason: String
})

const Bind = mongoose.model('bind', BindSchema)

module.exports = {
  addBind: function (bindinfo) {
    return new Promise((resolve, reject) => {
      var b = new Bind()
      b.userId = ''
      b.save()
      resolve({success: true})
    })
  }
}
